namespace HelpDesk.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class AddRequired : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.Tickets", "Priority_ID", "dbo.TicketPriorities");
            DropForeignKey("dbo.Tickets", "Status_ID", "dbo.TicketStatus");
            DropIndex("dbo.Tickets", new[] { "Priority_ID" });
            DropIndex("dbo.Tickets", new[] { "Status_ID" });
            AlterColumn("dbo.Tickets", "Priority_ID", c => c.Int(nullable: false));
            AlterColumn("dbo.Tickets", "Status_ID", c => c.Int(nullable: false));
            AddForeignKey("dbo.Tickets", "Priority_ID", "dbo.TicketPriorities", "ID", cascadeDelete: true);
            AddForeignKey("dbo.Tickets", "Status_ID", "dbo.TicketStatus", "ID", cascadeDelete: true);
            CreateIndex("dbo.Tickets", "Priority_ID");
            CreateIndex("dbo.Tickets", "Status_ID");
        }
        
        public override void Down()
        {
            DropIndex("dbo.Tickets", new[] { "Status_ID" });
            DropIndex("dbo.Tickets", new[] { "Priority_ID" });
            DropForeignKey("dbo.Tickets", "Status_ID", "dbo.TicketStatus");
            DropForeignKey("dbo.Tickets", "Priority_ID", "dbo.TicketPriorities");
            AlterColumn("dbo.Tickets", "Status_ID", c => c.Int());
            AlterColumn("dbo.Tickets", "Priority_ID", c => c.Int());
            CreateIndex("dbo.Tickets", "Status_ID");
            CreateIndex("dbo.Tickets", "Priority_ID");
            AddForeignKey("dbo.Tickets", "Status_ID", "dbo.TicketStatus", "ID");
            AddForeignKey("dbo.Tickets", "Priority_ID", "dbo.TicketPriorities", "ID");
        }
    }
}
